<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<script type="text/javascript">
    $(document).ready(function() {
        $('.topmenu ul li').hover(
                function() {
                    $(this).find('ul').stop(true, true);
                    $(this).find('ul').slideDown("fast");
                },
                function() {
                    $(this).find('ul').slideUp('fast');
                }
        );
        $.ajax({
                    url:"/voteup/getunreadunconfirmedcount",
                    type:'get',
                    dataType:"html",
                    success: function(data, textStatus) {
                        var unreadunconfirmed = data.split('\r\n');
                        if (unreadunconfirmed[0] > 0) {
                            $("#messages").html("Messages(" + unreadunconfirmed[0] + ")");
                            $("#recieved").html("New(" + unreadunconfirmed[0] + ")");
                        } else {
                            $("#messages").html("Messages");
                            $("#recieved").html("Recieved");
                        }
                        if (unreadunconfirmed[1] > 0) {
                            $("#friends").html("Friends(" + unreadunconfirmed[1] + ")");
                            $("#friends").attr('href', "/voteup/newfriends");
                        } else {
                            $("#friends").html("Friends");
                            $("#friends").attr('href', "/voteup/persons");
                        }
                    }
                });
    });
</script>

<html>
<head>
</head>
<body>
<div class="topmenu">
    <ul>
        <li><a href="/voteup/home" class="menubutton">Home page</a>
        </li>
        <li><a href="/voteup/universities" class="menubutton">Universities</a>
        </li>
        <li>
            <a href="/voteup/messages" class="menubutton" id="messages">Messages</a>
            <ul>
                <li><a href="/voteup/messages" id="recieved">Recieved</a></li>
                <li><a href="/voteup/messages?type=sent">Sent</a></li>
                <li><a href="/voteup/messages/sendmessage">New message</a></li>
            </ul>
        </li>
        <li>
            <a href="/voteup/persons" class="menubutton" id="friends">Friends</a>
            <ul>
                <li><a href="/voteup/persons/whovotedforme">My voters</a></li>
            </ul>
        </li>
        <li><a href="/voteup/logout" class="menubutton">Log out</a>
        </li>
    </ul>
</div>


</body>
</html>